package com.yanqu.road.server.manger.activity.recycle;

import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.entity.activity.ActivityItemRecycleData;
import com.yanqu.road.entity.enums.eActivityType;
import com.yanqu.road.server.manger.activity.ActivityMgr;
import com.yanqu.road.server.manger.activity.dragonboatrace.DragonBoatRaceMgr;
import com.yanqu.road.server.manger.activity.drink.DrinkMgr;

import java.util.ArrayList;
import java.util.List;

public class DrinkRecycleStrategy extends AbstractItemRecycleStrategy {
    @Override
    public void markNeedRecycleItem() {
        ActivityInfo activityInfo = DrinkMgr.getActivityInfo();
        if (activityInfo != null) {
            List<String> paramList = new ArrayList<>();
            long recycleTime = activityInfo.getEndTime() * 1000L + 600 * 1000;
            paramList.add(String.valueOf(DrinkMgr.getDrinkConfig().getEnergyRecItemId()));
            paramList.add(String.valueOf(DrinkMgr.getDrinkConfig().getScoreItemId()));
            paramList.add("1");
            paramList.add(activityInfo.getActivityName());
            ActivityItemRecycleMgr.addRecycleItemData(DrinkMgr.getDrinkConfig().getEnergyRecItemId(), activityType, 1, recycleTime, paramList);
        }
    }

    @Override
    public boolean isActivityRunning() {
        ActivityInfo activityInfo = DrinkMgr.getActivityInfo();
        return ActivityMgr.activityInTime(activityInfo);
    }

    @Override
    protected void initActivityType() {
        activityType = eActivityType.DrinkActivity.getValue();
    }

    @Override
    protected void doRecycle(long userId, ActivityItemRecycleData data) {
        item2Score(userId, data);
    }
}
